<%@page import="net.sf.window.scope.tl.WindowScopeRegistry"%>
<%@page import="net.sf.window.scope.WindowScope"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="ws" uri="http://net.sf.window.scope/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test Window Scope</title>
<script type="text/javascript" src="dwr/engine.js"></script>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="jquery-1.5.1.js"></script> 
<script type="text/javascript" src="yahoo-dom-event.js"></script> 
<script type="text/javascript" src="connection-min.js"></script> 
<script type='text/javascript' src='dwr/interface/idPrinter.js'></script>
<script type="text/javascript">
	jQuery.noConflict();
</script>
<ws:create />
<script type="text/javascript">
 function sucessfulAjaxWithAdditionalHeaders(message)
 {
	 jQuery('#jQueryAjaxReturnWithHeaders').html(message);
 }
 function sucessfulAjaxPrototype(respose)
 {
	 jQuery('#prototypeAjaxReturn').html(respose.responseText);
 }
 var yui2Callback =  {
		  success: function(xhr) {jQuery('#yui2AjaxReturn').html(xhr.responseText);},
		  failure: function(o) {console.warn("yui ajax failed: " + o);},
		  timeout: 5000
		};

</script>
</head>
<body>
	<form target="_blank" action="windowScopeTest">
		<input type="hidden" id="x-window-id" name="x-window-id" value="<%=WindowScopeRegistry.getWindowScope()%>" />
		<button type="submit" value="12">Submit w/id declared in form</button>
	</form>
	<form target="_blank" action="windowScopeTest">
		<button type="submit" value="12">Submit dynamic declaration</button>
	</form>
	<form target="_blank" action="windowScopeTest">
		<button type="submit" value="12">Submit w/id created via tag library</button>
		<ws:scopedInput />
	</form>
	<form target="_blank" action="testScope.jsp">
		<button type="submit" value="12">Submit Window Scope Flow</button>
	</form>
	<input type="button" onclick="javascript:jQuery('#jQueryAjaxReturn').load('windowScopeTest')" value="JQuery Ajax">
	<span id="jQueryAjaxReturn"></span>
	<br/>
	<input type="button" onclick="javascript:jQuery.ajax('windowScopeTest', {'headers': {'randomTestHeader': 'randomValue'}, 'dataType': 'text', 'success': sucessfulAjaxWithAdditionalHeaders})" value="JQuery Ajax w/additional header">
	<span id="jQueryAjaxReturnWithHeaders"></span>
	<br/>
	<input type="button" onclick="javascript:new Ajax.Request('windowScopeTest', {'onSuccess': sucessfulAjaxPrototype})" value="Prototype Ajax">
	<span id="prototypeAjaxReturn"></span>
	<br/>
	<input type="button" onclick="javascript:idPrinter.printIdWithSession(function(message){jQuery('#dwrAjaxReturn').html(message);})" value="DWR Ajax">
	<span id="dwrAjaxReturn"></span>
	<br/>
	<input type="button" onclick="javascript:YAHOO.util.Connect.asyncRequest('GET', 'windowScopeTest', yui2Callback)" value="YUI2 Ajax">
	<span id="yui2AjaxReturn"></span>
	
</body>
</html>